'use strict'
class upload {
    constructor () {

    }
    async post(c){
        // console.log(c)
        console.log('----------------------------------------------------------------')
        console.log('c.body：',c.body)
        console.log('----------------------------------------------------------------')
        console.log('c.files.img：',c.files.img)
        console.log('----------------------------------------------------------------')
        console.log('c.files:',c.files)
        console.log('----------------------------------------------------------------')
        // 保存图片文件
        let f = c.files.img[0];
        console.log('----------------------------------------------------------------')
        
        console.log("f:",f);
        let fname = c.helper.makeName(f.filename);
        let filePath = `/home/imgs/${fname}`;
        await c.moveFile(f,filePath);
        c.send(fname)
    }
}
module.exports = upload;